<?php
/**
 * 类名称
 * User: 13651
 * Time: 2025/10/23 14:50
 */

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;

class HuifuDataInfoJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * 设置超时时间
     * @var int
     */
    public $timeout = 0;

    public function __construct()
    {

    }

    public function handle()
    {
        try {
            ini_set('memory_limit', '1024M');
            set_time_limit(0);
            Log::info('---------');
            $file = 'D:\汇付\银行支行编码.xlsx';
            $excel_data = \App\Common\Excel\Excel::_readExcel($file);

            foreach ($excel_data as $k=>&$v){
                if ($k==0)
                    continue;
                $arr = [
                    'name'=>$v[1],
                    'code'=>$v[0],
                    'created_at'=>date('Y-m-d H:i:s'),
                    'updated_at'=>date('Y-m-d H:i:s'),
                ];
                DB::table('huifu_bank')->insert($arr);
            }
        }catch (\Exception $exception){
            Log::info($exception->getMessage());
        }

    }
}